package server.proxy.factory;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;

import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;

import server.proxy.RequestCounter;
import server.proxy.db.BlackList;
import server.proxy.db.WhiteList;


/**
 * This class creates all the single tones for the server.
 * @author Maxim
 *
 */
public class ProxySingletoneFactory {

	private static RequestCounter _requestCounter = null;
	private static WhiteList _whiteList = null;
	private static BlackList _blackList = null;
	
	public static   RequestCounter  getRequestCounterSingletone(){
		if (_requestCounter == null){
			_requestCounter = new RequestCounter();
		}
		return _requestCounter;
			
	}
	
	
	public static WhiteList getWhiteListSingletone() throws InvalidKeyException, NoSuchAlgorithmException, IllegalBlockSizeException, NoSuchPaddingException, BadPaddingException, InvalidKeySpecException, FileNotFoundException, IOException{
		
		if(_whiteList == null)
			_whiteList = new WhiteList();
		
		return _whiteList;
	}
	
	public static BlackList getBlackList() throws InvalidKeyException, NoSuchAlgorithmException, IllegalBlockSizeException, NoSuchPaddingException, BadPaddingException, InvalidKeySpecException, FileNotFoundException, IOException{
		
		if(_blackList == null)
			_blackList = new BlackList();
		
		return _blackList;
		
	}
	
	
	
	
}
